home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / Fonts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  11.5 KB  |  426 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        Fonts.h
  3.  
  4.      Contains:    Font Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacOS 8
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __FONTS__
  19. #define __FONTS__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50.  
  51. enum {
  52.     systemFont                    = 0,
  53.     applFont                    = 1
  54. };
  55.  
  56. /* kPlatformDefaultGuiFontID is used in QuickTime 3.0 */
  57. #if TARGET_OS_MAC
  58.  
  59. enum {
  60.     kPlatformDefaultGuiFontID    = applFont
  61. };
  62.  
  63. #else
  64.  
  65. enum {
  66.     kPlatformDefaultGuiFontID    = -1
  67. };
  68.  
  69. #endif  /* TARGET_OS_MAC */
  70.  
  71. /*
  72.     The following font constants are deprecated.  
  73.     Please use GetFNum() to look up the font ID by name.
  74. */
  75.  
  76. enum {
  77.     kFontIDNewYork                = 2,
  78.     kFontIDGeneva                = 3,
  79.     kFontIDMonaco                = 4,
  80.     kFontIDVenice                = 5,
  81.     kFontIDLondon                = 6,
  82.     kFontIDAthens                = 7,
  83.     kFontIDSanFrancisco            = 8,
  84.     kFontIDToronto                = 9,
  85.     kFontIDCairo                = 11,
  86.     kFontIDLosAngeles            = 12,
  87.     kFontIDTimes                = 20,
  88.     kFontIDHelvetica            = 21,
  89.     kFontIDCourier                = 22,
  90.     kFontIDSymbol                = 23,
  91.     kFontIDMobile                = 24
  92. };
  93.  
  94. #if OLDROUTINENAMES
  95.  
  96. enum {
  97.     newYork                        = kFontIDNewYork,
  98.     geneva                        = kFontIDGeneva,
  99.     monaco                        = kFontIDMonaco,
  100.     venice                        = kFontIDVenice,
  101.     london                        = kFontIDLondon,
  102.     athens                        = kFontIDAthens,
  103.     sanFran                        = kFontIDSanFrancisco,
  104.     toronto                        = kFontIDToronto,
  105.     cairo                        = kFontIDCairo,
  106.     losAngeles                    = kFontIDLosAngeles,
  107.     times                        = kFontIDTimes,
  108.     helvetica                    = kFontIDHelvetica,
  109.     courier                        = kFontIDCourier,
  110.     symbol                        = kFontIDSymbol,
  111.     mobile                        = kFontIDMobile
  112. };
  113.  
  114. #endif  /* OLDROUTINENAMES */
  115.  
  116.  
  117. enum {
  118.     commandMark                    = 17,
  119.     checkMark                    = 18,
  120.     diamondMark                    = 19,
  121.     appleMark                    = 20
  122. };
  123.  
  124.  
  125. enum {
  126.     propFont                    = 36864L,
  127.     prpFntH                        = 36865L,
  128.     prpFntW                        = 36866L,
  129.     prpFntHW                    = 36867L,
  130.     fixedFont                    = 45056L,
  131.     fxdFntH                        = 45057L,
  132.     fxdFntW                        = 45058L,
  133.     fxdFntHW                    = 45059L,
  134.     fontWid                        = 44208L
  135. };
  136.  
  137.  
  138. struct FMInput {
  139.     short                             family;
  140.     short                             size;
  141.     Style                             face;
  142.     Boolean                         needBits;
  143.     short                             device;
  144.     Point                             numer;
  145.     Point                             denom;
  146. };
  147. typedef struct FMInput                    FMInput;
  148.  
  149. struct FMOutput {
  150.     short                             errNum;
  151.     Handle                             fontHandle;                    /* the previous "privateFontResult" was a mistake! */
  152.     UInt8                             boldPixels;
  153.     UInt8                             italicPixels;
  154.     UInt8                             ulOffset;
  155.     UInt8                             ulShadow;
  156.     UInt8                             ulThick;
  157.     UInt8                             shadowPixels;
  158.     SInt8                             extra;
  159.     UInt8                             ascent;
  160.     UInt8                             descent;
  161.     UInt8                             widMax;
  162.     SInt8                             leading;
  163.     SInt8                             curStyle;
  164.     Point                             numer;
  165.     Point                             denom;
  166. };
  167. typedef struct FMOutput                    FMOutput;
  168.  
  169. typedef FMOutput *                        FMOutPtr;
  170. typedef FMOutput *                        FMOutputPtr;
  171.  
  172. struct FontRec {
  173.     short                             fontType;                    /*font type*/
  174.     short                             firstChar;                    /*ASCII code of first character*/
  175.     short                             lastChar;                    /*ASCII code of last character*/
  176.     short                             widMax;                        /*maximum character width*/
  177.     short                             kernMax;                    /*negative of maximum character kern*/
  178.     short                             nDescent;                    /*negative of descent*/
  179.     short                             fRectWidth;                    /*width of font rectangle*/
  180.     short                             fRectHeight;                /*height of font rectangle*/
  181.     unsigned short                     owTLoc;                        /*offset to offset/width table*/
  182.     short                             ascent;                        /*ascent*/
  183.     short                             descent;                    /*descent*/
  184.     short                             leading;                    /*leading*/
  185.     short                             rowWords;                    /*row width of bit image / 2 */
  186. };
  187. typedef struct FontRec                    FontRec;
  188. typedef FontRec *                        FontRecPtr;
  189. typedef FontRecPtr *                    FontRecHdl;
  190.  
  191. struct FMetricRec {
  192.     Fixed                             ascent;                        /*base line to top*/
  193.     Fixed                             descent;                    /*base line to bottom*/
  194.     Fixed                             leading;                    /*leading between lines*/
  195.     Fixed                             widMax;                        /*maximum character width*/
  196.     Handle                             wTabHandle;                    /*handle to font width table*/
  197. };
  198. typedef struct FMetricRec                FMetricRec;
  199. /*
  200.    typedef struct FMetricRec FMetricRec, *FMetricRecPtr;
  201.    typedef FMetricRecPtr *FMetricRecHandle;
  202. */
  203. typedef FMetricRec *                    FMetricRecPtr;
  204. typedef FMetricRecPtr *                    FMetricRecHandle;
  205.  
  206. struct WidEntry {
  207.     short                             widStyle;                    /*style entry applies to*/
  208. };
  209. typedef struct WidEntry                    WidEntry;
  210.  
  211. struct WidTable {
  212.     short                             numWidths;                    /*number of entries - 1*/
  213. };
  214. typedef struct WidTable                    WidTable;
  215.  
  216. struct AsscEntry {
  217.     short                             fontSize;
  218.     short                             fontStyle;
  219.     short                             fontID;                        /*font resource ID*/
  220. };
  221. typedef struct AsscEntry                AsscEntry;
  222.  
  223. struct FontAssoc {
  224.     short                             numAssoc;                    /*number of entries - 1*/
  225. };
  226. typedef struct FontAssoc                FontAssoc;
  227.  
  228. struct StyleTable {
  229.     short                             fontClass;
  230.     long                             offset;
  231.     long                             reserved;
  232.     char                             indexes[48];
  233. };
  234. typedef struct StyleTable                StyleTable;
  235.  
  236. struct NameTable {
  237.     short                             stringCount;
  238.     Str255                             baseFontName;
  239. };
  240. typedef struct NameTable                NameTable;
  241.  
  242. struct KernPair {
  243.     char                             kernFirst;                    /*1st character of kerned pair*/
  244.     char                             kernSecond;                    /*2nd character of kerned pair*/
  245.     short                             kernWidth;                    /*kerning in 1pt fixed format*/
  246. };
  247. typedef struct KernPair                    KernPair;
  248.  
  249. struct KernEntry {
  250.     short                             kernStyle;                    /*style the entry applies to*/
  251.     short                             kernLength;                    /*length of this entry*/
  252. };
  253. typedef struct KernEntry                KernEntry;
  254.  
  255. struct KernTable {
  256.     short                             numKerns;                    /*number of kerning entries*/
  257. };
  258. typedef struct KernTable                KernTable;
  259.  
  260. struct WidthTable {
  261.     Fixed                             tabData[256];                /*character widths*/
  262.     Handle                             tabFont;                    /*font record used to build table - the previous FontResult was a mistake!*/
  263.     long                             sExtra;                        /*space extra used for table*/
  264.     long                             style;                        /*extra due to style*/
  265.     short                             fID;                        /*font family ID*/
  266.     short                             fSize;                        /*font size request*/
  267.     short                             face;                        /*style (face) request*/
  268.     short                             device;                        /*device requested*/
  269.     Point                             inNumer;                    /*scale factors requested*/
  270.     Point                             inDenom;                    /*scale factors requested*/
  271.     short                             aFID;                        /*actual font family ID for table*/
  272.     Handle                             fHand;                        /*family record used to build up table*/
  273.     Boolean                         usedFam;                    /*used fixed point family widths*/
  274.     UInt8                             aFace;                        /*actual face produced*/
  275.     short                             vOutput;                    /*vertical scale output value*/
  276.     short                             hOutput;                    /*horizontal scale output value*/
  277.     short                             vFactor;                    /*vertical scale output value*/
  278.     short                             hFactor;                    /*horizontal scale output value*/
  279.     short                             aSize;                        /*actual size of actual font used*/
  280.     short                             tabSize;                    /*total size of table*/
  281. };
  282. typedef struct WidthTable                WidthTable;
  283. typedef WidthTable *                    WidthTablePtr;
  284. typedef WidthTablePtr *                    WidthTableHdl;
  285.  
  286.  
  287. struct FamRec {
  288.     short                             ffFlags;                    /*flags for family*/
  289.     short                             ffFamID;                    /*family ID number*/
  290.     short                             ffFirstChar;                /*ASCII code of 1st character*/
  291.     short                             ffLastChar;                    /*ASCII code of last character*/
  292.     short                             ffAscent;                    /*maximum ascent for 1pt font*/
  293.     short                             ffDescent;                    /*maximum descent for 1pt font*/
  294.     short                             ffLeading;                    /*maximum leading for 1pt font*/
  295.     short                             ffWidMax;                    /*maximum widMax for 1pt font*/
  296.     long                             ffWTabOff;                    /*offset to width table*/
  297.     long                             ffKernOff;                    /*offset to kerning table*/
  298.     long                             ffStylOff;                    /*offset to style mapping table*/
  299.     short                             ffProperty[9];                /*style property info*/
  300.     short                             ffIntl[2];                    /*for international use*/
  301.     short                             ffVersion;                    /*version number*/
  302. };
  303. typedef struct FamRec                    FamRec;
  304.  
  305. typedef SInt16                             FontPointSize;
  306. typedef SInt16                             FontFamilyID;
  307. EXTERN_API( void )
  308. InitFonts                        (void)                                                        ONEWORDINLINE(0xA8FE);
  309.  
  310. EXTERN_API( void )
  311. GetFontName                        (short                     familyID,
  312.                                  Str255                 name)                                ONEWORDINLINE(0xA8FF);
  313.  
  314. EXTERN_API( void )
  315. GetFNum                            (ConstStr255Param         name,
  316.                                  short *                familyID)                            ONEWORDINLINE(0xA900);
  317.  
  318. EXTERN_API( Boolean )
  319. RealFont                        (short                     fontNum,
  320.                                  short                     size)                                ONEWORDINLINE(0xA902);
  321.  
  322. EXTERN_API( void )
  323. SetFontLock                        (Boolean                 lockFlag)                            ONEWORDINLINE(0xA903);
  324.  
  325. EXTERN_API( FMOutPtr )
  326. FMSwapFont                        (const FMInput *        inRec)                                ONEWORDINLINE(0xA901);
  327.  
  328. EXTERN_API( void )
  329. SetFScaleDisable                (Boolean                 fscaleDisable)                        ONEWORDINLINE(0xA834);
  330.  
  331. EXTERN_API( void )
  332. FontMetrics                        (FMetricRecPtr             theMetrics)                            ONEWORDINLINE(0xA835);
  333.  
  334. EXTERN_API( void )
  335. SetFractEnable                    (Boolean                 fractEnable)                        ONEWORDINLINE(0xA814);
  336.  
  337. EXTERN_API( short )
  338. GetDefFontSize                    (void)                                                        FIVEWORDINLINE(0x3EB8, 0x0BA8, 0x6604, 0x3EBC, 0x000C);
  339.  
  340. EXTERN_API( Boolean )
  341. IsOutline                        (Point                     numer,
  342.                                  Point                     denom)                                TWOWORDINLINE(0x7000, 0xA854);
  343.  
  344. EXTERN_API( void )
  345. SetOutlinePreferred                (Boolean                 outlinePreferred)                    TWOWORDINLINE(0x7001, 0xA854);
  346.  
  347. EXTERN_API( Boolean )
  348. GetOutlinePreferred                (void)                                                        TWOWORDINLINE(0x7009, 0xA854);
  349.  
  350. EXTERN_API( OSErr )
  351. OutlineMetrics                    (short                     byteCount,
  352.                                  const void *            textPtr,
  353.                                  Point                     numer,
  354.                                  Point                     denom,
  355.                                  short *                yMax,
  356.                                  short *                yMin,
  357.                                  FixedPtr                 awArray,
  358.                                  FixedPtr                 lsbArray,
  359.                                  RectPtr                 boundsArray)                        TWOWORDINLINE(0x7008, 0xA854);
  360.  
  361. EXTERN_API( void )
  362. SetPreserveGlyph                (Boolean                 preserveGlyph)                        TWOWORDINLINE(0x700A, 0xA854);
  363.  
  364. EXTERN_API( Boolean )
  365. GetPreserveGlyph                (void)                                                        TWOWORDINLINE(0x700B, 0xA854);
  366.  
  367. EXTERN_API( OSErr )
  368. FlushFonts                        (void)                                                        TWOWORDINLINE(0x700C, 0xA854);
  369.  
  370. #if CGLUESUPPORTED
  371. EXTERN_API_C( void )
  372. getfnum                            (const char *            theName,
  373.                                  short *                familyID);
  374.  
  375. EXTERN_API_C( void )
  376. getfontname                        (short                     familyID,
  377.                                  char *                    theName);
  378.  
  379. #endif  /* CGLUESUPPORTED */
  380.  
  381. EXTERN_API( short )
  382. GetSysFont                        (void)                                                        TWOWORDINLINE(0x3EB8, 0x0BA6);
  383.  
  384. EXTERN_API( short )
  385. GetAppFont                        (void)                                                        TWOWORDINLINE(0x3EB8, 0x0984);
  386.  
  387.  
  388. EXTERN_API( void )
  389. AntiTextSetApplicationAware        (Boolean                 aware)                                TWOWORDINLINE(0x7024, 0xA854);
  390.  
  391. EXTERN_API( Boolean )
  392. AntiTextGetApplicationAware        (void)                                                        TWOWORDINLINE(0x7025, 0xA854);
  393.  
  394. EXTERN_API( void )
  395. AntiTextSetEnabled                (Boolean                 enabled)                            TWOWORDINLINE(0x7026, 0xA854);
  396.  
  397. EXTERN_API( Boolean )
  398. AntiTextGetEnabled                (void)                                                        TWOWORDINLINE(0x7027, 0xA854);
  399.  
  400. EXTERN_API( Boolean )
  401. AntiTextIsAntiAliased            (Point                     numer,
  402.                                  Point                     denom)                                TWOWORDINLINE(0x7028, 0xA854);
  403.  
  404.  
  405.  
  406. #if PRAGMA_STRUCT_ALIGN
  407.     #pragma options align=reset
  408. #elif PRAGMA_STRUCT_PACKPUSH
  409.     #pragma pack(pop)
  410. #elif PRAGMA_STRUCT_PACK
  411.     #pragma pack()
  412. #endif
  413.  
  414. #ifdef PRAGMA_IMPORT_OFF
  415. #pragma import off
  416. #elif PRAGMA_IMPORT
  417. #pragma import reset
  418. #endif
  419.  
  420. #ifdef __cplusplus
  421. }
  422. #endif
  423.  
  424. #endif /* __FONTS__ */
  425.  
  426.